package com.hikari.ai.oldpathfinding;

import java.awt.Graphics;

public class MyCircle {
    protected int x;
    protected int y;
    protected int radius;

    public MyCircle() {
    }

    public MyCircle(int x, int y, int radius) {
        this.x = x;
        this.y = y;
        this.radius = radius;
    }

    public int getX() {
        return x;
    }

    public int getY() {
        return y;
    }

    public int getRadius() {
        return radius;
    }

    public void setX(int x) {
        this.x = x;
    }

    public void setY(int y) {
        this.y = y;
    }

    public void setRadius(int radius) {
        this.radius = radius;
    }

    public boolean circleIntersect(MyCircle circle) {
        float rsqv=circle.radius+radius;
        rsqv*=rsqv;
        float xsqv=circle.x-x;
        xsqv*=xsqv;
        float ysqv=circle.y-y;
        ysqv*=ysqv;
        
        return (xsqv+ysqv)<=rsqv;
    }

    public void draw(Graphics g) {
        g.drawOval(x- radius, y- radius, radius* 2, radius*2);
    }
    
    @Override
    public String toString() {
        return "X=" + x + " Y=" + y + " R=" + radius;
    }
}
